// xc_lshop/savemoney/com/proitem.js
Component({
  options: {
    addGlobalClass: true,
    multipleSlots: true
  },
  /**
   * 组件的属性列表
   */
  properties: {
    item: { // 产品数据
      type: Object,
      value: {}
    },
    itemwidth:{
      type: Number,
      value: 0
    },
    customstyle:{
      type: String,
      value: ""
    },
    logo:{
      type: String,
      value: ""
    },
    size:{ // 字体大小 normal mini
      type: String,
      value: "normal"
    },
    source:{
      type: String,
      value: ""
    }
  },
  ready(){
    if(this.data.itemwidth==0){
      var windowWidth="";
      
      wx.getSystemInfo({
        success: (result) => {
          windowWidth=result['windowWidth']
        },
      })
      var width=(windowWidth - 30) * 0.485 
      width=width.toFixed(2)
      this.setData({
        itemwidth:width
      })
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
      
  },

  /**
   * 组件的方法列表
   */
  methods: {
    clickpro(e){
      console.log("e")
      var that = this;
      var app=getApp();

      app.xc_sys_config.authop.oppower("login").then(function (res) {
        
        if(res['status']==1){
          that.setData({
            member:res['obj']
          })
          app.globalData.member=res['obj']
          var dataset = e.currentTarget.dataset;
          var item=dataset.item
          var id=item.goodsId;
          wx.navigateTo({
            url: '../index/detail?goodsId='+id+'&source='+that.data.source,
          })
  
        }
      })
     
      
      // console.log(e)
  
    },
  }
})
